package com.qf.mapper;

import com.qf.domain.Student;
import com.qf.domain.Student2;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface StudentMapper {

    /**
     * 查询所有学生信息的接口方法
     * @return
     */
    List<Student2> findAll();

    Student findById(Integer id);

    Student findByName(String name);

    int insert(Student stu);

    int delete(Integer id);

    int update(Student stu);

    Student findByNameAndAge(@Param("name") String name, @Param("age") Integer age);

    /**
     * 如果student有name，有age 根据这两个条件查询  select * from student where name=? and age=?
     * student没有name，没有age 无条件查询   select * from student
     * student有name，没有age 根据name查询   select * from student where name=?
     * student没有name，有age 根据age查询    select * from student where age=?
     * @param student
     * @return
     */
    List<Student> findByConditions(Student student);


    /**
     *  select * from student where id =? or id=? or id=? ===> select * from student where id in (?,?,?)
     * @param ids
     * @return
     */
    List<Student> findByIds(Integer... ids);
    List<Student> findByIds2(List<Integer> ids);
}
